// 用户路由模块
const express = require('express')
const userHandler = require('../router_handler/userHandler')
const expressJoi = require('@escook/express-joi')
const { register_user_schema, login_user_schema, update_user_schema } = require('../schema/userSchema')

const router = express.Router()

// 注册用户
router.post('/users', expressJoi(register_user_schema), userHandler.registerUser)

// 用户登录
router.post('/user/login', expressJoi(login_user_schema), userHandler.loginUser)

// 获取当前用户信息
router.get('/user/current', userHandler.getUserInfo)

// 修改用户信息
router.patch('/user', expressJoi(update_user_schema), userHandler.updateUser)

module.exports = router